<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<title>欢迎页面-X-admin2.2</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript" src="./lib/layui/layui.js"
	charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
<!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
</head>

<body>
	<form onsubmit="false">
		<div class="layui-form" style="margin-top: 20px">
			<script type="text/javascript" src="./lib/layui/layui.js"></script>
			<div class="layui-form-item" hidden="sid">
				<label class="layui-form-label">id</label>
				<div class="layui-input-block">
					<input type="text" name="sid" id="sid" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">姓名</label>
				<div class="layui-input-block">
					<input type="text" name="sName" id="sName" required
						lay-verify="required" autocomplete="off" class="layui-input"
						style="width: 190px">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">卡号</label>
				<div class="layui-input-block">
					<input type="text" name="sCard" id="sCard" required
						autocomplete="off" class="layui-input" style="width: 190px">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">密码</label>
				<div class="layui-input-block">
					<input type="text" name="sCardPassword" id="sCardPassword" required
						autocomplete="off" class="layui-input" style="width: 190px">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>
					性别</label>
				<div class="layui-input-block" style="width: 190px">
					<select name="sSex" id="sSex">
						<option value=""></option>
						<option>男</option>
						<option>女</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">年龄</label>
				<div class="layui-input-block">
					<input type="text" name="sAge" id="sAge" required
						lay-verify="required" autocomplete="off" class="layui-input"
						style="width: 190px">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">手机号</label>
				<div class="layui-input-block">
					<input type="text" name="sPhoneNum" id="sPhoneNum" required
						lay-verify="required" autocomplete="off" class="layui-input"
						style="width: 190px">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">状态</label>
				<div class="layui-input-block">
					<input type="text" name="statuses" id="statuses" required
						lay-verify="required" autocomplete="off" class="layui-input"
						style="width: 190px">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
				</div>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="./lib/layui/layui.js"></script>
	<script type="text/javascript">
		layui.use([ 'form', 'laydate' ], function() {
			var form = layui.form;
			var $ = layui.jquery; //引入jquery
			var laydate = layui.laydate;
			var layer = layui.layer;

			form.on('submit(formDemo)', function(data) {
				var d = {
					'sid' : $("#sid").val(),
					'sName' : $("#sName").val(),
					'sCard' : $("#sCard").val(),
					'sCardPassword' : $("#sCardPassword").val(),
					'sSex' : $("#sSex").val(),
					'sAge' : $("#sAge").val(),
					'sPhoneNum' : $("#sPhoneNum").val(),
					'statuses' : $("#statuses").val()
				}
				var url = "/updateStudent";
				$.post(url, d, function(res) {
					console.log(res);
					if (res.count > 0) {
						var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
						parent.layer.close(index); //再执行关闭   
					}
				}, 'json');
				return false;
			});

		});
	</script>
</body>

</html>